package cn.tedu.vacate.service.impl;

import cn.tedu.vacate.mapper.VacateMapper;
import cn.tedu.vacate.pojo.dto.VacateSaveParam;
import cn.tedu.vacate.pojo.entity.Vacate;
import cn.tedu.vacate.service.VacateService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class VacateServiceImpl implements VacateService {
    @Autowired
    private VacateMapper vacateMapper;

    @Override
    public void saveLeave(VacateSaveParam vacateSaveParam) {
        //保存请假条
        Vacate vacate = new Vacate();
        BeanUtils.copyProperties(vacateSaveParam,vacate);
        vacate.setCreateTime(vacateSaveParam.getStartTime());
        vacateMapper.insertLeave(vacate);
    }
}
